package com.example.demo.huawei;

import java.util.Scanner;

// 滑动窗口实现，连续子区间，就应该想到滑动窗口
public class OD51_3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int x = scanner.nextInt();
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        int left = 0;
        int right = 0;
        int count = 0;
        int sum = 0;
        while (right < arr.length) {
            sum += arr[right];
            while (sum >= x) {
                sum -= arr[left];
                left++;
                // 后面的都可以组成满足要求的区间
                // 如果3 4满足 那么再加上4后面的元素都符合条件 所以需要加上 n- right
                count += n - right;
            }
            right++;
        }
        System.out.println(count);
    }
}
